package com.org.gsc.zsqdemos.uis;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;

import com.org.gsc.zsqdemos.R;
import com.org.gsc.zsqdemos.adapters.MypstAdapter;
import com.org.gsc.zsqdemos.tabs.SlidingTabLayout;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by qundui on 2017/6/18.
 */

public class SlidingTabLayoutDemo extends FragmentActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.slideingdemo);
        ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
        List<String> datas=new ArrayList<>();
        for(int i=0;i<20;i++){
            datas.add("第"+(i+1)+"条Tab");

        }
        viewPager.setAdapter(new MypstAdapter(getSupportFragmentManager(),datas));
        SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
        slidingTabLayout.setDistributeEvenly(true); //是否填充满屏幕的宽度
        slidingTabLayout.setViewPager(viewPager);
         //自定义下划线颜色
        slidingTabLayout.setCustomTabColorizer(new SlidingTabLayout.TabColorizer(){
            @Override
            public int getIndicatorColor(int position) {
                return Color.RED;
            }
        });

        //自定义展示样式
        //slidingTabLayout.setCustomTabView(R.layout.your_custom_tab, 0);
    }
}
